home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
049b.dms
/
049b.adf
/
MORE_SOURCE_CODE
/
Line.AMOS
/
Line.amosSourceCode
Wrap
AMOS Source Code
|
1992-02-26
|
823b
|
50 lines
'Very fast line routine.
'
'Author ?
'
LINE[10,10,22,33]
' Good for sampling points on a straight line for example.
Procedure LINE[X1,Y1,X2,Y2]
XD=X2-X1
YD=Y2-Y1
SS=1
If XD<0
XD=Abs(XD)
SS=-SS
End If
If YD<0
YD=Abs(YD)
SS=-SS
End If
If XD>YD
CC=XD/2
If X1>X2
Swap X1,X2
Swap Y1,Y2
End If
YT=Y1
For XT=X1 To X2
Plot XT,YT
Add CC,YD
If CC>XD
Add YT,SS
Add CC,-XD
End If
Next XT
Else
CC=YD/2
If Y1>Y2
Swap Y1,Y2
Swap X1,X2
End If
XT=X1
For YT=Y1 To Y2
Plot XT,YT
Add CC,XD
If CC>=YD
Add XT,SS
Add CC,-YD
End If
Next YT
End If
End Proc